Compile-time Unit Testing
نویسندگان
چکیده
Unit testing is an essential part in high quality software development. The prerequisite of the system-wide test is that all components are working correctly. Such components are checked by unit tests which are focused on small part of code. Unit tests are isolated from other code fragments and are frequently programmed by using third party tools. In this paper we show how to minimalize the number of the required third party tools, and how to automate unit tests. We aimed to express unit tests as part of the source code, and execute them during the compilation to ensure the quality of the code. Two different approaches are presented in this paper: the first is based on the C++11's new mechanisms, such as constant expressions, and static assertions; the second is based on our experimental programming language, Welltype, which offers more flexible unit testing than C++11 – however, both technique are similar. The key in both approaches to get the compiler to execute additional, user defined calculations which can result errors during the compilation. In C++11 the static assertions are used to evaluate parts of the unit tests. Since constant expressions are restricted, in this paper we also present a method how to overcome those restrictions, and how to utilize static assertion with constant expressions. Finally, we describe how our experimental language offers compiler support to evaluate pure expressions at compile-time.
منابع مشابه
Integrating Software Testing and Run-Time Checking in an Assertion Verification Framework
We present a framework that unifies unit testing and runtime verification (as well as static verification and static debugging). A key contribution of our overall approach is that we preserve the use of a unified assertion language for all of these tasks. We first describe a method for compiling run-time checks for (parts of) assertions which cannot be verified at compile-time via program trans...
متن کاملA Methodology for Systematic Verification of OPS5-Based AI Applications
One of the critical problems in putting AI applications into use in the real world is the lack of sufficient formal theories and practical took that aid the process of reliability assessment. Adhoc testing, which is widely used as a means of verification, serves limited purpose. A need for systematic verification by compile-time analysis exists. In this article, we focus our attention on OPS5-b...
متن کاملEnabling cross-library optimization and compile-time error checking in the presence of procedural macros
Libraries and top-level programs are the basic units of portable code in the language defined by the Revised Report on Scheme. As such, they are naturally treated as compilation units, with source optimization and certain forms of compile-time error checking occurring within but not across library and program boundaries. This paper describes a library-group form that can be used to turn a group...
متن کاملVirtual Hardware for Operating Systems
Developing an operating system on bare hardware is diicult due to an inhospitable development environment, long edit-compile-run-debug times, and the need for extra target hardware. This paper contributes general techniques for creating virtual hardware for operating systems development. The virtual machine is realized on top of UNIX and is a close approximation of real hardware, including inte...
متن کاملWriting Self-testing Java Classes with SelfTest
This document provides a tutorial introduction to Java annotations called SelfTest. The SelfTest annotations allow one to annotate Java classes with test data, and the SelfTest annotation processor generates executable JUnit test classes from annotated Java classes by translating test cases to executable JUnit tests. The SelfTest annotations not only automate unit testing of Java classes signif...
متن کاملذخیره در منابع من
با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید
عنوان ژورنال:
دوره شماره
صفحات -
تاریخ انتشار 2015